package pack

import "mall_frontend_api/biz/model"

func GetUserName(user *model.UserInfo) string {
	if user == nil {
		return ""
	}
	if user.FirstName == "" {
		return user.LastName
	}
	if user.LastName == "" {
		return user.FirstName
	}
	return user.FirstName + "·" + user.LastName
}

func RevertUserInfo(data *model.User) *model.UserInfo {
	if data == nil {
		return nil
	}
	var info model.UserInfo
	info.ID = data.ID
	info.FirstName = data.FirstName
	info.LastName = data.LastName
	info.Email = data.Email
	info.BizID = data.BizID
	info.Avatar = data.Avatar
	info.Account = data.Account
	return &info
}
